package com.fh.service.information.photo;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.fh.dao.DaoSupport;
import com.fh.entity.Page;
import com.fh.util.PageData;

@Service("PhotoService")
public class PhotoService {
	@Resource(name = "daoSupport")
	private DaoSupport dao;

	/**
	 * 
	 * TODO 方法作用：列表
	 * 
	 * @param page
	 * @return
	 * @throws Exception
	 * @Author: 孙超文
	 * @Date: 2015-7-2 上午9:45:03
	 */
	public List<PageData> list(Page page) throws Exception {
		List<PageData> list = (List<PageData>) dao.findForList("PhotoMapper.listPage", page);

		return list;
	}

	/**
	 * 
	 * TODO 方法作用：通过id获取数据
	 * 
	 * @param pd
	 * @return
	 * @throws Exception
	 * @Author: 孙超文
	 * @Date: 2015-7-2 上午9:45:15
	 */
	public PageData findById(PageData pd) throws Exception {
		return (PageData) dao.findForObject("PhotoMapper.findById", pd);
	}

	public void save(PageData pd) throws Exception {
		dao.save("PhotoMapper.insert", pd);
	}

	/**
	 * 
	 * TODO 方法作用：修改
	 * 
	 * @param pd
	 * @return
	 * @throws Exception
	 * @Author: 孙超文
	 * @Date: 2015-7-2 上午9:45:15
	 */
	public void edit(PageData pd) throws Exception {
		dao.update("PhotoMapper.update", pd);
	}

	/**
	 * 
	 * TODO 方法作用：删除
	 * 
	 * @param pd
	 * @return
	 * @throws Exception
	 * @Author: 孙超文
	 * @Date: 2015-7-2 上午9:45:15
	 */
	public void delete(PageData pd) throws Exception {
		dao.update("PhotoMapper.delete", pd);
	}

	/*
	 * 批量删除
	 */
	public void deleteAll(String[] ids) throws Exception {
		dao.delete("PhotoMapper.deleteAll", ids);
	}

}
